package structural.flyweight;

import java.util.HashMap;
import java.util.Map;

public class PointIconFactory {
    private final Map<PointType, PointIcon> pointIcons = new HashMap<>();

    public PointIcon getIcon(PointType type) {
        PointIcon icon = pointIcons.get(type);
        if (icon == null) {
            // Simulate loading an icon from a resource
            byte[] iconData = new byte[100]; // Placeholder for actual icon data
            icon = new PointIcon(type, iconData);
            pointIcons.put(type, icon);
        }
        return icon;
    }
}
